import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
  title = 'angular-demo';
  public keyword: string | undefined;
  public historyList:any[]=[];

  constructor() { }

  ngOnInit(): void {
  }

  doSearch(){

    if(this.historyList.indexOf(this.keyword)==-1){

      this.historyList.push(this.keyword);
    }
    this.keyword='';
  }

  deleteHistory(key: number){
    this.historyList.splice(key,1);
  }
}
